package com.hyg.lib_common.ui.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.hyg.lib_base.MyView.BodyConstitutionPoint;
import com.hyg.lib_base.MyView.CustomRadarView;
import com.hyg.lib_base.mainUtils.StatusBarUtil;
import com.hyg.lib_common.Base.BaseActivity;
import com.hyg.lib_common.R;
import com.hyg.lib_common.databinding.ActivityTestSelfTizhiResultBinding;

import java.util.ArrayList;

public class TestSelfTizhiResultActivity extends BaseActivity {
    ActivityTestSelfTizhiResultBinding binding;

    String type;
    String result;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityTestSelfTizhiResultBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        StatusBarUtil.setStatusBar(1, this, getResources().getColor(R.color.white), 60, null, null, true);
        init();
    }

    public void init() {
        type = getIntent().getStringExtra("type");
        String result_main = getIntent().getStringExtra("main");
        String result_vice = getIntent().getStringExtra("vice");
        String result = "经检测，您的主要体质为" + result_main;
        if (!TextUtils.isEmpty(result_vice)) {
            result += "\n次要体制为" + result_vice;
        }
        ArrayList<BodyConstitutionPoint> list = getIntent().getParcelableArrayListExtra("list");
        binding.tvTestResult.setText(result);
        binding.radarView.setData(list);
        binding.radarView.setBody(result_main,result_vice);
        binding.tvRetest.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(TestSelfTizhiResultActivity.this, TestSelfTizhiActivity.class);
                intent.putExtra("type", type);
                startActivity(intent);
                finish();
            }
        });
        binding.back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    public void onBack(View view) {
        finish();
    }




}